package com.jt.demo2;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/add")  //公共路径
@RestController     //表示Controller类,同时要求返回值为JSON
@ResponseBody
public class name1 {

    @RequestMapping("/add/asd")   //实现浏览器的请求路径与方法的映射
    @ResponseBody  //将返回的数据转化为JSON串, 如果是字符串本身 原数据返回
    public String  asd(){
        System.out.println("你是");
        return "孙小姐";
    }

    @RequestMapping("/asc")
    @ResponseBody
    public Private pp(){
        Private aPrivate = new Private();
        aPrivate.setAge(110);
        aPrivate.setName("警察局");
        aPrivate.setSs(120);
        return aPrivate;
    }

    @RequestMapping("/asb")
    @ResponseBody
    public String asb(Integer nn){
        return "String编号："+nn;
    }

    @ResponseBody
    @RequestMapping("/asb1/{id}/{eax}")
    public String asb1(@PathVariable Integer id,
                       @PathVariable String eax){
        return id+"id;"+eax+"eax";
    }

    @RequestMapping("/asb2/{name}/{age}/{ss}")
    public Private abc1(Private p){
        return p;
    }

    @GetMapping("/asb21/{name}/{age}/{ss}")
    public Private abc2(Private p){
        return p;
    }

    @PostMapping("/asb22/{name}/{age}/{ss}")
    public Private abc3(Private p){
        return p;
    }

    @DeleteMapping("/asb23/{name}/{age}/{ss}")
    public Private abc4(Private p){
        return p;
    }

    @PutMapping("/asb24/{name}/{age}/{ss}")
    public Private abc5(Private p){
        return p;
    }

}
